package com.weijianhuawen.wjblog.admin.convert;

import com.weijianhuawen.wjblog.admin.mode.vo.comment.FindCommentPageListRspVo;
import com.weijianhuawen.wjblog.common.domain.dos.CommentDo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @version: java version 8
 * @Author: weijianhuawen
 * @description:
 * @date: 2024-12-22 15:40
 */

@Mapper
public interface CommentConvert {
    // 初始化转换器实例
    CommentConvert INSTANCE = Mappers.getMapper(CommentConvert.class);

    // 将do转换为分页列表do
    @Mappings({
            @Mapping(target = "userId", expression = "java(String.valueOf(bean.getUserId()))"),
            @Mapping(target = "id", expression = "java(String.valueOf(bean.getId()))")
    })
    FindCommentPageListRspVo do2PageListVo(CommentDo bean);
}
